#ifndef MY_SIMPLE_SD_H
#define MY_SIMPLE_SD_H

#include "esp_vfs_fat.h"
#include <string>

#ifdef __cplusplus

extern "C"
{ /*YOU MUST PAY ATTENTION THAT THIS API WILL
 INNITIALIZE OF THE SPI AT THE SAME TIME*/
    class SDCard
    {
    public:
        esp_err_t init(int pin_MOSI, int pin_MISO, int pin_CLK, int pin_CS);
        FILE *open(const std::string &path, const std::string &method);

        static SDCard &GetInstance()
        {
            static SDCard instance;
            return instance;
        }

    private:
        SDCard(){}
    };

    extern SDCard &SD;
}
#endif

#endif